package me.zhengjie.sqlservice.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import me.zhengjie.mapper.IwsWareHouseMapper;
import me.zhengjie.pojo.entity.IwsWareHouse;
import me.zhengjie.sqlservice.IwsWareHouseService;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class IwsWareHouseServiceImpl extends ServiceImpl<IwsWareHouseMapper, IwsWareHouse> implements IwsWareHouseService {
    private final IwsWareHouseMapper iwsWareHouseMapper;

    @Override
    public IwsWareHouse selectStorageCode(String storageCode) {
        LambdaQueryWrapper<IwsWareHouse> iwsWareHouseLambdaQueryWrapper = new LambdaQueryWrapper<>();
        iwsWareHouseLambdaQueryWrapper.eq(IwsWareHouse::getStoreId,storageCode);
        return iwsWareHouseMapper.selectOne(iwsWareHouseLambdaQueryWrapper);
    }

//    @Override
//    public boolean updateStorage(String storeId, int IsExist) {
//        LambdaUpdateWrapper<IwsWareHouse> iwsWareHouseLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
//        iwsWareHouseLambdaUpdateWrapper.set(IwsWareHouse::getIsExist,IsExist)
//                .eq(IwsWareHouse::getStoreId,storeId);
//        return iwsWareHouseMapper.update(null,iwsWareHouseLambdaUpdateWrapper) >0;
//    }
}
